/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.foxline.model;

import br.com.foxline.enums.TypeAnnex;
import java.io.InputStream;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Date;
import javax.persistence.*;

/**
 *
 * @author ely
 *
 * Annexo
 */
@Entity
public class Annex implements Serializable {

    @Id
    @SequenceGenerator(sequenceName = "seq_annex", name = "seq_annex", allocationSize = 1)
    @GeneratedValue(generator = "seq_annex", strategy = GenerationType.SEQUENCE)
    private Long id;
    @Enumerated(EnumType.STRING)
    private TypeAnnex type_annex;
    private String description;
    private String type;
    private String url;
    @Lob
    private byte[] fileByte;
    
        
    @Lob
    @Column
    private String content;
    
    private String UUID;
    private String cod;
    
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateCreateMobile;

    @Transient
    private InputStream croquiRelatorio;
     
    public Annex() {
    }

    public InputStream getCroquiRelatorio() {
        return croquiRelatorio;
    }

    public void setCroquiRelatorio(InputStream croquiRelatorio) {
        this.croquiRelatorio = croquiRelatorio;
    }

    
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public TypeAnnex getType_annex() {
        return type_annex;
    }

    public void setType_annex(TypeAnnex type_annex) {
        this.type_annex = type_annex;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public byte[] getFileByte() {
        return fileByte;
    }

    public void setFileByte(byte[] fileByte) {
        this.fileByte = fileByte;
    }

    public String getUUID() {
        return UUID;
    }

    public void setUUID(String UUID) {
        this.UUID = UUID;
    }

    public String getCod() {
        return cod;
    }

    public void setCod(String cod) {
        this.cod = cod;
    }

   
    public Date getDateCreateMobile() {
        return dateCreateMobile;
    }

    public void setDateCreateMobile(Date dateCreateMobile) {
        this.dateCreateMobile = dateCreateMobile;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Annex other = (Annex) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        if (this.type_annex != other.type_annex) {
            return false;
        }
        if ((this.description == null) ? (other.description != null) : !this.description.equals(other.description)) {
            return false;
        }
        if ((this.type == null) ? (other.type != null) : !this.type.equals(other.type)) {
            return false;
        }
        if ((this.url == null) ? (other.url != null) : !this.url.equals(other.url)) {
            return false;
        }
        if (!Arrays.equals(this.fileByte, other.fileByte)) {
            return false;
        }
        if ((this.content == null) ? (other.content != null) : !this.content.equals(other.content)) {
            return false;
        }
        if ((this.UUID == null) ? (other.UUID != null) : !this.UUID.equals(other.UUID)) {
            return false;
        }
        if ((this.cod == null) ? (other.cod != null) : !this.cod.equals(other.cod)) {
            return false;
        }
        if (this.dateCreateMobile != other.dateCreateMobile && (this.dateCreateMobile == null || !this.dateCreateMobile.equals(other.dateCreateMobile))) {
            return false;
        }
        if (this.croquiRelatorio != other.croquiRelatorio && (this.croquiRelatorio == null || !this.croquiRelatorio.equals(other.croquiRelatorio))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 37 * hash + (this.id != null ? this.id.hashCode() : 0);
        hash = 37 * hash + (this.type_annex != null ? this.type_annex.hashCode() : 0);
        hash = 37 * hash + (this.description != null ? this.description.hashCode() : 0);
        hash = 37 * hash + (this.type != null ? this.type.hashCode() : 0);
        hash = 37 * hash + (this.url != null ? this.url.hashCode() : 0);
        hash = 37 * hash + Arrays.hashCode(this.fileByte);
        hash = 37 * hash + (this.content != null ? this.content.hashCode() : 0);
        hash = 37 * hash + (this.UUID != null ? this.UUID.hashCode() : 0);
        hash = 37 * hash + (this.cod != null ? this.cod.hashCode() : 0);
        hash = 37 * hash + (this.dateCreateMobile != null ? this.dateCreateMobile.hashCode() : 0);
        hash = 37 * hash + (this.croquiRelatorio != null ? this.croquiRelatorio.hashCode() : 0);
        return hash;
    }

    @Override
    public String toString() {
        return "Annex{" + "id=" + id + ", type_annex=" + type_annex + ", description=" + description + ", type=" + type + ", url=" + url + ", fileByte=" + fileByte + '}';
    }

}
